extends "../qiaozhiwushi-3/qiaozhiwushi-3.gd"


var baseId = ""
var upText1 = "队友击杀敌人时自己也能获得魂"
var upText2 = "魂之挽歌无需吟唱"
func _extInit():
	._extInit()
	lv = 4             #等级的设置
	addSkill("魂满后会开始吟唱大招，吟唱时间3秒，期间无法炮击，吟唱成功后，对当前目标周围3格的敌人造成[炮击*8]的技能伤害", "魂之挽歌")

var skIndex4 = 0
var sing = false
func _upS():
	._upS()
	if soul >= 20:
		sing = true
	if sing:
		skIndex4 += 1
		if skIndex4 >= 3 or upgraded == 2:
			soulSing()

func soulSing():
	utils.createSkillTextEff("灵魂吟唱", position)
	sing = false
	skIndex4 = 0
	for i in getCellChas(aiCha.cell, 3, 1):
		azurHurtChara(i, att.atk*8, sys.HurtType.WEAPON, sys.AtkType.SKILL, "魂之挽歌")
	soul *= 0.5

func normalAtkChara(cha):
	if not sing:
		.normalAtkChara(cha)

func _onBattleEnd():
	._onBattleEnd()
	sing = false
	skIndex4 = 0

func _onCharaDel(cha):
	._onCharaDel(cha)
	if not is_instance_valid(cha):return
	if not cha.isSumm and cha.team != team and upgraded == 1:
		soul += 1